<script setup lang="ts">
import ReCol from "@/components/ReCol";
import { ref } from "vue";
import { formRules } from "./utils/rule";
import { FormProps } from "./utils/types";
import Segmented from "@/components/ReSegmented";
import {usePublicHooks} from "@/views/system/hooks";
import SplitPane from "@/components/ReSplitPane";
const { switchStyle } = usePublicHooks();

const props = withDefaults(defineProps<FormProps>(), {
  formInline: () => ({
    id: 0,
    group_name: "",
    status: 1,
  }),
  depsAll:()=>([])
});

const ruleFormRef = ref();
const newFormInline = ref(props.formInline);
const newFormDepList = ref(props.depsAll);
function getRef() {
  return ruleFormRef.value;
}

defineExpose({ getRef });

</script>

<template>

  <el-form ref="ruleFormRef" :model="newFormInline"  :rules="formRules"  label-width="120px" size="small" >
    <el-row :gutter="30">
      <re-col :value="12" :xs="24" :sm="24">
        <el-form-item label="店铺分组名称" prop="group_name">
          <el-input v-model="newFormInline.group_name" clearable placeholder="请输入店铺分组"/>
        </el-form-item>
      </re-col>
      <re-col >
        <el-form-item label="绑定业务员分组" prop="dep_ids">
          <el-select v-model="newFormInline.dep_ids" placeholder="请输入店铺分组" class="!w-full" clearable multiple>
            <el-option class="w-full" v-for="(item, index) in newFormDepList" :key="index" :value="item.id" :label="item.department_name"/>
          </el-select>
        </el-form-item>

      </re-col>
      <re-col>
        <el-form-item label="备注">
          <el-input v-model="newFormInline.remark" placeholder="请输入备注信息" type="textarea"/>
        </el-form-item>
      </re-col>
      <re-col :value="24" :xs="24" :sm="24">
        <el-form-item label="状态">
          <el-switch
            v-model="newFormInline.status"
            inline-prompt
            :active-value="1"
            :inactive-value="0"
            active-text="启用"
            inactive-text="停用"
            :style="switchStyle"
          />
        </el-form-item>
      </re-col>
    </el-row>
  </el-form>

</template>
